<template>
	<view>
		<view class="taber-box">
			<view class="" @click="goPage(1)">
				<image v-if="tabIndex == 1" style="width: 60rpx;height: 60rpx;" src="../../static/images/index11.png" mode=""></image>
				<image v-else style="width: 60rpx;height: 60rpx;" src="../../static/images/index1.png" mode=""></image>
				<view class="">
					转入
				</view>
			</view>
			<view class="" @click="goPage(2)">
				<image v-if="tabIndex == 2" style="width: 60rpx;height: 60rpx;" src="../../static/images/index21.png" mode=""></image>
				<image v-else style="width: 60rpx;height: 60rpx;" src="../../static/images/index2.png" mode=""></image>
				<view class="">
					转出
				</view>
			</view>
			<view class="addForm" @click="goPage(3)">
				<view class="addForm-view">+</view>
			</view>
			<view class="" @click="goImpage">
				<image style="width: 60rpx;height: 60rpx;" src="../../static/images/message.png" mode=""></image>
				<view class="">
					消息
				</view>
			</view>
			<view class="" @click="goPage(4)">
				<image style="width: 60rpx;height: 60rpx;" src="../../static/images/message.png" mode=""></image>
				<view class="">我的</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		genTestUserSig
	} from 'subPackages/static/utils/GenerateTestUserSig.js'
	export default {
		data() {
			return {
				identityData:""
			}
		},
		props:{
			tabIndex:{
				type:Number,
				default:1
			}
		},
		onShow() {
			let that = this;
			
		},
		methods: {
			goPage(num){
				let that = this;
				uni.getStorage({
					key:"userInfo",
					success: function (res) {
						that.identityData = JSON.parse(res.data).identity_data;
						if(num=='1'){
							uni.navigateTo({
								url:"/pages/index/index"
							})
						}else if(num=='2'){
							if(that.identityData == 2 || that.identityData == 4){
								uni.navigateTo({
									url:"/pages/transferOut/transferOut"
								})
							}else{
								uni.showToast({
									title:"功能开发中...",
									icon:"none"
								})
							}
						}else if(num=='3'){
							if(that.identityData == 2 || that.identityData == 4){
								uni.navigateTo({
									url:"/pages/referralApplication/referralApplication"
								})
							}else{
								uni.showToast({
									title:"功能开发中...",
									icon:"none"
								})
							}
						}else if(num=='4'){
							uni.navigateTo({
								url:"/pages/mine/mine"
							})
						}
					}
				})
				
			},
			goImpage(){
				uni.getStorage({
					key: 'userInfo',
					success: function (res) {
						const userID = JSON.parse(res.data).tencent_id;
						wx.$app.login({
							userID:String(JSON.parse(res.data).tencent_id),
							userSig: genTestUserSig(String(JSON.parse(res.data).tencent_id)).userSig
						}).then(() => {
							uni.navigateTo({
								url:"/subPackages/pages/index/main"
							})
						})
					}
				});
			}
		}
	}
</script>

<style scoped>
.taber-box{
	display: flex;
	justify-content: center;
	align-items: center;
	background: #fff;
	height: 170rpx;
	width: 100%;
	position: fixed;
	left: 0;
	bottom: 0;
}
.taber-box>view{
	flex: 1;
	text-align:center;
}
.addForm{
	font-size:50rpx;
	text-align: center;
}
.addForm-view{
	width:90rpx;
	height:90rpx;
	line-height: 80rpx;
	text-align:center;
	margin: 0 auto;
	border-radius: 50%;
	background-color:#929292;
	color: #fff;
}
</style>
